package DemoText;
/**
 * 求和
 */

import java.util.Scanner;

public class LuoGuP8772 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int sum = 0;
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = in.nextInt();
            sum += nums[i];
        }
        int ret = 0;
        for (int i = 0; i < n; i++) {
            sum -= nums[i];
            ret += sum * nums[i];
        }
        System.out.println(ret);
    }
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = in.nextInt();
        int[] dp = new int[n + 1];
        long sum = 0;
        for (int i = n; i > 0; i--) {
            dp[i - 1] = dp[i] + nums[i - 1];
            sum += (long) dp[i] * nums[i - 1];
        }
        System.out.println(sum);
        in.close();
    }
}
